home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
kowin
/
archive
/
apl
/
beav13ko.lzh
/
humanio.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-11-15
|
3KB
|
173 lines
/*
* The functions in this file negotiate with the operating system for
* characters, and write characters in a barely buffered fashion on the display.
* All operating systems.
*/
#include <sys_doslib.h>
#include "def.h"
int nrow; /* Terminal size, rows. */
int ncol; /* Terminal size, columns. */
/*
* This function is called once to set up the terminal device streams.
* On VMS, it translates TT until it finds the terminal, then assigns
* a channel to it and sets it raw. On CPM it is a no-op.
*/
void
ttopen()
{
#ifdef KOWIN
nrow= ttrow= MTmScreenY;
#else
int y= B_CONSOL( -1, -1, -1, -1 );
nrow= ttrow= y & 0xffff;
#endif
ncol= ttcol= 80;
}
/*
* This function gets called just before we go back home to the command
* interpreter. On VMS it puts the terminal back in a reasonable state.
* Another no-operation on CPM.
*/
void
ttclose()
{
}
/*
* Write a character to the display. On VMS, terminal output is buffered, and
* we just put the characters in the big array, after checking for overflow.
* On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
* MS-DOS (use the very very raw console output routine).
*/
void
ttputc( c )
{
#ifdef KOWIN
MTmPutc( c );
#else
B_PUTC( c );
#endif
}
/*
* Flush terminal buffer. Does real work where the terminal output is buffered
* up. A no-operation on systems where byte at a time terminal I/O is done.
*/
void
ttflush()
{
#ifdef KOWIN
MTmFlush();
#endif
}
/*
* Read a character from the terminal, performing no editing and doing no echo
* at all. More complex in VMS that almost anyplace else, which figures. Very
* simple on CPM, because the system can do exactly what you want.
*/
ttgetc()
{
#ifdef KOWIN
static unsigned short key_pad[]= {
0x23c, /* 1 M-< 先頭*/
0x23e, /* 2 M-> 最後*/
0x225, /* 3 M-% 置換*/
0x253, /* 4 M-s 検索*/
0x254, /* 5 M-t 次*/
0x22e, /* 6 M-. mark */
0x017, /* 7 ^W cut */
0x257, /* 8 M-w copy */
0x019, /* 9 ^Y yank */
0x43d, /*10 ^X= show pos */
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x0,
0x016, /* RUP ^V */
0x256, /* RDW M-V */
0x449, /* INS ^XI */
0x004, /* DEL ^D */
0x010, /* UP ^P */
0x002, /* LEF ^B */
0x006, /* RIG ^F */
0x00e, /* DOW ^N */
0x00c, /* CLR ^L */
0x23f, /* HLP M-? */
0x558, /* HOME ^X^X */
0x0, /* UNDO */
};
unsigned int c;
MTmSetAttr( MTaAttr, MTmFont_y );
if( (c= MTaGetc()) >= 0x100 )
c= key_pad[(c&0x1f)-1];
return c;
#else
unsigned int c;
for(; !(c= INPOUT( 0xff )) ;)
CHANGE_PR();
return c;
#endif
}
ttkeyready()
{
return INPOUT( 0xfe );
}
HumanGoto( x, y )
{
#ifdef KOWIN
MTmFlush();
MTmGoto( x, y );
#else
B_LOCATE( x, y );
#endif
}
HumanEol()
{
#ifdef KOWIN
MTmClrLine( 0 );
#else
B_ERA_ED();
#endif
}
HumanEop()
{
#ifdef KOWIN
MTmSetAttr( MTaAttr, MTmFont_y );
MTmClrScreen( 0 );
#else
B_COLOR( 3 );
B_CLR_ED();
#endif
}
HumanBeep()
{
}
HumanColor( color )
{
#ifdef KOWIN
if( color )
MTmSetAttr( MTaAttr^AttrReverse, MTmFont_y );
else
MTmSetAttr( MTaAttr, MTmFont_y );
#else
if( color )
B_COLOR( 11 );
else
B_COLOR( 3 );
#endif
}